#Used for intializing the other modules and spawning threads for the GUI and mqinterface
#
#Written by Tony

import mqinterface, cache, threading, model, gui_controller
from functools import partial

def start_message_consumption(theMQInterface):
    theMQInterface.start_consumption()

if __name__ == "__main__":
    theCache = cache.Cache()
    viewManager = model.View_Manager(theCache)
    guiController = gui_controller.GUIC(viewManager, theCache)
    theMQInterface = mqinterface.MQInterface(theCache, local=True)
    
    mqThread = threading.Thread(target=partial(start_message_consumption, theMQInterface))
    mqThread.start()
    
    guiController.show_window()
        
    theMQInterface.close_connection()
    
    